package 动态规划;

public class 把数字翻译成字符串 {

    public int translateNum(int num) {
        int p=0,q=0,r=1;
        String s = String.valueOf(num);
        for (int i = 0; i <s.length(); i++) {
            p=q;
            q=r;
            r=0;
            r+=q;
            if (i==0)
                continue;
            String s1 = s.substring(i - 1, i + 1);
            if (s1.compareTo("25")<=0 && s1.compareTo("10")>=0)
                r+=p;
        }
        return r;
    }
}
